<template>
  <div :class="wrpCls">
    <!--    <a-button size="small">好商标名，要注册</a-button>-->
    <message-dropdown :class="prefixCls" :count="count"></message-dropdown>
    <avatar-dropdown :menu="showMenu" :current-user="currentUser" :class="prefixCls" />
    <!--    <select-lang :class="prefixCls" />-->
  </div>
</template>

<script>
import { mapGetters } from 'vuex'
import MessageDropdown from './MessageDropdown'
import AvatarDropdown from './AvatarDropdown'
// import SelectLang from '@/components/SelectLang'

export default {
  name: 'RightContent',
  components: {
    MessageDropdown,
    AvatarDropdown
  },
  props: {
    prefixCls: {
      type: String,
      default: 'ant-pro-global-header-index-action'
    },
    isMobile: {
      type: Boolean,
      default: () => false
    },
    topMenu: {
      type: Boolean,
      required: true
    },
    theme: {
      type: String,
      required: true
    }
  },
  data () {
    return {
      showMenu: true,
      currentUser: {},
      count: 0
    }
  },
  methods: {
    onLocation () {
      window.location.reload()
    }
  },
  computed: {
    // 从vuex中获取头像和昵称
    ...mapGetters(['avatar', 'name', 'msgCount']),

    wrpCls () {
      return {
        'ant-pro-global-header-index-right': true,
        [`ant-pro-global-header-index-${(this.isMobile || !this.topMenu) ? 'light' : this.theme}`]: true
      }
    }
  },
  mounted () {
    setTimeout(() => {
      this.currentUser = {
        name: this.name,
        avatar: this.avatar
      }
      this.count = parseInt(this.msgCount)
    }, 1500)
  }
}
</script>
